#!/bin/bash -x

# read config
. ../../steps.config

cd config_office
echo $configureswitches
./configure --enable-werror $configureswitches || exit $?

cd ..

#put name of OOo config file created by configure in $envname
. ../../getOOoEnv

if [ -z "$envname" ] ; then
  echo Cannot determine configuration file name
  echo Please adapt the script on the buildslave
  echo cannot set CWS and Languages for build
  exit 1
fi

CWS=`echo $* | grep '\--branch' | sed -e 's/.*--branch\=//' -e 's/ .*//' | grep -v _`
if [ "$CWS" ] ; then
  echo CWS_WORK_STAMP=$CWS >> $envname
  echo CWS_WORK_STAMP_EXT=_$CWS >> $envname
  echo export CWS_WORK_STAMP CWS_WORK_STAMP_EXT >> $envname
fi

LANG=`echo $* | grep '\--languages' | sed -e 's/.*--languages\=\"//' -e 's/\".*//'`
echo WITH_LANG=\"\$WITH_LANG\ $LANG\" >> $envname
echo export WITH_LANG >> $envname

echo done

